const globleurl = require('./serverconfig.js').url;//全局url

//封装wx请求方法
exports.myrequest = (url, data = {}, method = 'GET') => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: globleurl + url, //字符串
            data, //参数对象
            method, //字符串，请求方式
            success: (result) => {
                resolve(result);
            },
            fail: (err) => {
                reject(err);
                throw err;
            }
        });

    })
}

